/************************************************************************/
/* Game                                                                 */
/************************************************************************/
#include "Game/Game Objects/Towers/SnifitTower.h"

namespace TD_Game {


	/************************************************************************/
	/* Flower tower definitions                                             */
	/************************************************************************/

	const int SnifitTower::shootingInterval[NUMBER_OF_LEVELS] =				{1200, 1200, 1100, 1100, 1000, 800};
	const unsigned int SnifitTower::towerRadius[NUMBER_OF_LEVELS] =			{175, 175, 175, 200, 200, 225};
	const unsigned int SnifitTower::towerDamage[NUMBER_OF_LEVELS] =			{18, 35, 40, 60, 82, 102};
	const unsigned int SnifitTower::towerPrice[NUMBER_OF_LEVELS] =			{30, 50, 80, 115, 150, 180};
	const unsigned int SnifitTower::towerValue[NUMBER_OF_LEVELS] =			{35, 50, 60, 70, 90, 110};
	const string SnifitTower::towerName = "Torre Snifit";


	const SnifitTower * SnifitTower::m_pStaticReference = NULL;
	
   shared_ptr<SDLSound> SnifitTower::m_pHittedSound = shared_ptr<SDLSound>();
   shared_ptr<SDLSound> SnifitTower::m_pLaunchSound = shared_ptr<SDLSound>();

	/************************************************************************/
	/* Protected functions                                                  */
	/************************************************************************/
	void SnifitTower::initBaseValues() {
		for(unsigned int i = 0; i < NUMBER_OF_LEVELS; i++) {
			m_shootingInterval[i] = shootingInterval[i];
			m_towerDamage[i] = towerDamage[i];
			m_towerRange[i] = towerRadius[i];
			m_towerPrice[i] = towerPrice[i];
			m_towerValue[i] = towerValue[i];
		}
		m_towerName = towerName;

		m_pDescriptionTile = new Tile(Coord2D(0.81191*screenWidth, 0.375*screenHeight), Coord2D(184, 74), 
			imgTile, TD_Resources::ResourceManager::loadImage("GUI/Descriptions/snifitTowerDescription.png", Color::PINK));
		m_baseTowerType = snifitTower_lvl1;
		m_baseShotType = iceShot_lvl1;
		//Upgrade bar displacement
		m_upBarDisplacement = Coord2D(-15, 50);
	}

	/************************************************************************/
	/* ctors and dtors                                                      */
	/************************************************************************/

	SnifitTower::SnifitTower() {
		initBaseValues();
	}

	SnifitTower::SnifitTower(const SnifitTower & rhs) {

	}

	SnifitTower & SnifitTower::operator=(const SnifitTower &rhs) {
		BaseTower::operator=(rhs);
		return(*this);
	}

	SnifitTower::SnifitTower(unsigned int g_ID, const Coord2D & turretPosition) : BaseTower (g_ID, turretPosition) {

		initBaseValues();

		m_pAnimationSet = AnimationSetFactory::createTowerAnimationSet(m_baseTowerType, "Idle");
		m_pBaseShotAS = AnimationSetFactory::createShotAnimationSet(m_baseShotType, "Moving");

		m_shapes.push_back(new RectangleShape(turretPosition - m_pAnimationSet->getSprites()->getTilesize()/2, m_pAnimationSet->getSprites()->getTilesize()));
	}

	SnifitTower::~SnifitTower() {

	}
}